<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSalesmanInfoTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('salesman_info', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('salesmanid')->comment('地推人员ID');
            $table->integer('cityid')->comment('城市id');
            $table->string('name', 64)->comment('名称');
            $table->integer('registernum')->default(0)->comment('注册数');
            $table->decimal('registermoney', 16, 2)->default(0.00)->comment('注册佣金');
            $table->integer('ordernum')->default(0)->comment('订单数');
            $table->integer('ordervalidnum')->default(0)->comment('有效订单数');
            $table->decimal('ordermoney', 16, 2)->default(0.00)->comment('订单佣金');
            $table->decimal('ordertotalamount', 16, 2)->default(0.00)->comment('订单总金额');
            $table->integer('rechargenum')->default(0)->comment('充值数');
            $table->integer('rechargevalidnum')->default(0)->comment('有效充值数');
            $table->decimal('rechargemoney', 16, 2)->default(0.00)->comment('充值佣金');
            $table->decimal('rechargetotalamount', 16, 2)->default(0.00)->comment('充值总金额');
            $table->decimal('totalmoney', 16, 2)->default(0.00)->comment('总佣金');
            $table->decimal('withdrawalmoney', 16, 2)->default(0.00)->comment('已提现金额');
            $table->decimal('balance', 16, 2)->default(0.00)->comment('余额');
            $table->string('qrcode', 64)->default('')->comment('二维码');
            $table->dateTime('bindingtime')->comment('二维码');
            $table->integer('salesmansetid')->default(0)->comment('地推设置id');
            $table->integer('lastsalesmansetid')->default(0)->comment('上一次地推设置id');
            $table->dateTime('effectivedate')->comment('生效时间');
            $table->integer('currentregisternum')->default(0)->comment('当前方案注册数');
            $table->integer('currentordernum')->default(0)->comment('当前方案订单数');
            $table->decimal('currentordertotalamount', 16, 2)->default(0)->comment('当前方案实付金额');
            $table->integer('currentrechargenum')->default(0)->comment('当前方案充值数');
            $table->integer('currentrechargetotalamount')->default(0)->comment('当前方案充值金额');
            $table->decimal('currenttotalmoney', 16, 2)->default(0)->comment('当前方案收入');
            $table->tinyInteger('status')->default(0)->comment('状态');
            $table->integer('adminid')->default(0)->comment('操作员id');
            $table->string('info')->nullable()->comment('预留');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('salesman_info');
    }
}
